TO_BOOL block
Short summary
Name |
|
→POU type |
|
Category |
|
Conform to →IEC-standard |
currently restricted; see "Functionality" and more possible than defined in IEC-standard; see "Explicit conversion according to IEC-standard" |
Graphical interface |
|
Available since |
|
Functionality
The blocks serves for explicitly converting the value connected to input IN
into a value of data type BOOL
.
If the connected value is within the range of values overlapping for the data type of the input and for the result value BOOL
, the blocks returns this value.
Deviation from IEC-standard The IEC-standard defines that the conversion for the data types as defined by the IEC-standard is done as a binary transfer. However, this block deviates from the IEC-standard. If the value |
Observe as well:
-
If converting data types to the
TIME
data type and vice versa, the conversion is always based on seconds. -
If the value
0
,1
,TRUE
orFALSE
of data typeSTRING
is connected to the input (whereTRUE
andFALSE
may even be case insensitive, e.g.'TRue'
,STRING#'FalSE'
), the value is converted accordingly (hence:TRUE
,FALSE
). In this case, the outputENO
is set to valueTRUE
.
In case of other values (e.g.STRING#'2'
,'BOOL#TRUE'
,' TRUE'
), the block returns the valueFALSE
. In this case, the outputENO
is set to valueFALSE
. Special case: If the connected value starts with0
,1
,TRUE
orFALSE
(it may be case insensitive as well) and other characters follow (e.g.'05'
,'True_1'
,'falseFlag'
), the block returns the starting value as it is supported (hence:0
,TRUE
,FALSE
) and the outputENO
is set to valueFALSE
. -
If the value
0
or1
, of data typeCHAR
is connected to the input (e.g:'0'
,CHAR#'1'
), the value is converted accordingly (hence:0
,1
). In this case, the outputENO
is set to valueTRUE
.
In case of other values (e.g.'9'
,CHAR#'A'
), the block returns the valueFALSE
. In this case, the outputENO
is set to valueFALSE
.
Explicit conversion according to IEC-standard
The IEC-standard defines an explicit conversion of the following data types to BOOL
:
BYTE
, WORD
, DWORD
, LWORD
The IEC-standard (Edition 3.0) defines a binary transfer for all data types of the input. But contrary to this, the appropriate value is converted according to the IEC-standard (Edition 2.0) for the following data types of the input.
BYTE
, WORD
, DWORD
, LWORD
Details on the Neuron Power Engineer behavior of the block can be found in the section "Functionality".
Inputs, return value
|
Identifier |
Description |
|
---|---|---|---|
Inputs: |
|
|
value to be converted |
Return value: |
– |
|
|
Input EN
and output ENO
are available when →calling the block. See "Execution control: EN, ENO" for information on input EN
and output ENO
.
See:
-
"Blocks for safe logic" whether this block is supported for developing safety-relevant applications.
-
"Highlighting safe logic in the FBD-editor" for the effects when using the block as a block for safe logic.
Internal error diagnostic for block
The block checks the value connected to the input. The output ENO
of the block is set to value FALSE
(or an equivalent) in the following cases:
-
A
STRING
value contains or starts with an invalid character. (The value returned by the block depends on the position of the invalid characters. See the description under "Functionality" above.) -
A
CHAR
value contains an invalid character. (Moreover for this case, the block returns the valueFALSE
.)
Example for usage within ST-editor
|
When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.